<template>
  <div class="address">
    <div class="list">
      <div
        class="item"
        @click="goToDeliveryConfirmat(item)"
        v-for="item in address"
        :key="item.id"
      >
        <div class="left">
          <div class="top fz14">
            <span>{{ item.name }}</span
            ><span>{{ item.tel }}</span>
          </div>
          <div class="add fz12">{{ item.add }}</div>
        </div>
        <div class="right fz14">编辑</div>
      </div>
    </div>
    <div class="bottomAdd" @click="$router.push('/addNewAddress')">
      <van-button>
        新增收货地址
      </van-button>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'Address',
  computed: {
    ...mapState('address', ['address'])
    // ...mapGetters('channel', ['optionalChannels'])
  },
  data() {
    return {
      ...mapState
    }
  },
  methods: {
    //   选择用户地址返回提货界面
    goToDeliveryConfirmat(item) {
      //   this.$router.push({ path: '/deliveryConfirmat', query: item })
      this.$router.push({ name: 'deliveryConfirmat', query: item })
      this.$toast('收获地址已添加,可以提货了')
    }
  }
}
</script>

<style lang="less" scoped>
.address {
  width: 100vw;
  height: 100vh;
  //   height: calc(100vh-60px);
  //   height: 100vh;
  background: #f7f6fb;
  .list {
    padding: 0 12px;
    background-color: #fff;
    width: 100%;
    .item {
      padding: 0 12px;
      width: 351px;
      height: 72px;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #f7f6fb;
      box-shadow: 0px -1px 0px 0px #f7f6fb;
      align-items: center;
      .left {
        .top {
          font-weight: 600;
          color: #1f0d44;
          span:first-child {
            margin-right: 9px;
          }
        }
        .add {
          margin-top: 9px;
        }
        // display: flex;
        // flex-direction: column;
        // justify-content: space-between;
      }
      .right {
        font-weight: 400;
        color: #1677ff;
      }
    }
  }
  //   新增按钮
  .bottomAdd {
    position: fixed;
    bottom: 0;
    left: 0;
    background-color: #fff;
    width: 100%;
    height: 60px;
    // padding: 10px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    .van-button {
      width: 351px;
      height: 40px;
      color: #fff;
      background: linear-gradient(315deg, #622ccc 0%, #ff5bf4 100%);
      border-radius: 20px;
      font-size: 14px;
      font-weight: 500;
      color: #ffffff;
    }
  }
}
</style>
